import './publicpath.js'
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { BrowserRouter } from 'react-router-dom'
import actions from './actions'
let root = null
function render({ container, baseUrl } = {}) {
  root = ReactDOM.createRoot(container ? container.querySelector('#sub-react') : document.getElementById("sub-react"));
  root.render(
    <React.StrictMode>
      <BrowserRouter basename={window.__POWERED_BY_QIANKUN__ ? baseUrl : '/'}>
        <App />
      </BrowserRouter>
    </React.StrictMode>
  );
}

// 独立运行微应用
if (!window.__POWERED_BY_QIANKUN__) {
  render();
}

// 导出生命周期函数

export async function bootstrap() {}

export async function mount(props) {
  actions.setActions(props)
  render(props);
}

export async function unmount(props) {
  root.unmount();
}

export async function update() {
  // 更新微应用
}

reportWebVitals();
